package com.cdu.guoxinan.www.smartcom.controller;

import com.cdu.guoxinan.www.smartcom.aop.Annotation.OperationLog;
import com.cdu.guoxinan.www.smartcom.domian.dto.QueryPageDTO;
import com.cdu.guoxinan.www.smartcom.domian.pojo.Page;
import com.cdu.guoxinan.www.smartcom.domian.vo.LoginVO;
import com.cdu.guoxinan.www.smartcom.service.PageService;
import com.cdu.guoxinan.www.smartcom.unit.model.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/page")
@Api(tags = "页面控制器")
public class PageController {
    @Resource
    private PageService pageService;
    @PostMapping("/add")
    @ApiModelProperty("添加页面")
    @OperationLog(description = "添加页面")
    public R add(Page page){
        return pageService.add(page);
    }
    @GetMapping("/query")
    @ApiModelProperty("查询页面")
    public R query(QueryPageDTO querypageDTO){
        return pageService.query(querypageDTO);
    }
    @PostMapping("/delete")
    @ApiModelProperty("删除页面")
    @OperationLog(description = "删除页面")
    public R delete(Integer pageId){
        return pageService.delete(pageId);
    }
    @PostMapping("/update")
    @ApiModelProperty("修改页面")
    @OperationLog(description = "修改页面")
    public R update(Page page){
        return pageService.update(page);
    }
}
